package org.jeecg.modules.demo.weixin.payorder.service;


import com.baomidou.mybatisplus.extension.service.IService;
import org.jeecg.common.api.vo.Result;
import org.jeecg.modules.demo.weixin.dto.PayDto;
import org.jeecg.modules.demo.weixin.entity.MerchantPay;
import org.jeecg.modules.demo.weixin.entity.PayOrder;
import org.jeecg.modules.demo.weixin.entity.RefundRecord;
import org.jeecg.modules.demo.weixin.entity.SmtSplitMerchant;

import java.util.List;
import java.util.Map;

/**
 * @Description: pay_order
 * @Author: jeecg-boot
 * @Date:   2023-10-23
 * @Version: V1.0
 */
public interface IPayOrderService extends IService<PayOrder> {

    //调用微信支付（商户）
    Map<String, String> payOrder(PayDto payDto,Integer orderId);

    //调用微信支付（服务商）
    Map<String, String> servicePayOrder(MerchantPay merchantPay, PayDto payDto,PayOrder payOrder, Integer orderId);

    //调用微信查询订单接口（商户）
    Result<?> queryOrder(PayDto payDto,Integer outTradeNo);

    //调用微信查询订单接口（服务商）
    Result<?> queryServiceOrder(PayDto payDto,Integer outTradeNo);

    //支付时用户余额逻辑处理以及不同订单类型的逻辑处理
    Result<?> balance(PayDto payDto);

    //退款时处理订单逻辑
    Result<?> updateOrder(RefundRecord refundRecord);

    //次卡充值逻辑处理
    void card(PayDto payDto,Integer orderId);

    //商家商品逻辑处理
    void merchantShop(PayDto payDto,Integer orderId);

    //根据订单状态保存订单
    Result<?> saveOrderByOrderType(PayDto payDto,PayOrder payOrder);


    List<PayOrder> queryUserdetails(List<PayOrder> payOrderList,String merId);




     Result<?> orderByOrderType(PayDto payDto, PayOrder payOrder);

     void calcOrder();

//    void calcOrderMerchantId(String merchantId);
//
//    void calcOrderRecordId(Integer recordId);

    /**
     * 校验订单库存
     * @param payDto
     * @return
     */
    Boolean  checkMerShop(PayDto payDto);


    List<SmtSplitMerchant> dailyMerchant(String merchantId, String startTime, String endTime);




    Result<?> serviceAlipayOrder(PayDto payDto,PayOrder payOrder, Integer orderId);
}
